package com.imy.touch.runnable;

import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.GestureDescription;
import android.graphics.Path;
import android.os.Build;
import android.os.SystemClock;
import android.util.Log;

import com.imy.common.util.ToastUtil;
import com.imy.touch.TouchCore;
import com.imy.touch.bean.GesturePoint;
import com.imy.touch.root.client.SocketClient;
import com.imy.touch.root.command.ProtocolCreate;

public class BaseGestureRunnable {
  protected GesturePoint mPoint;

  public BaseGestureRunnable(GesturePoint point) {
    mPoint = point;
  }

  protected void down4Root() {
    SocketClient client = TouchCore.get().getClient();
    String down = ProtocolCreate.createDown((int) mPoint.x, (int) mPoint.y, mPoint.id);
    client.getTransceiver().send(down);

  }

  protected void unSupportVer() {
    ToastUtil.toast(TouchCore.get().getContext(),"该系统版本不支持无障碍手势");
  }

  protected SocketClient getClient() {
    return TouchCore.get().getClient();
  }

  protected void up4Root() {
    SocketClient client = TouchCore.get().getClient();
    client.getTransceiver().send(ProtocolCreate.createUp((int) mPoint.x, (int) mPoint.y, mPoint.id));

  }

  protected void move4Root() {
    SocketClient client = TouchCore.get().getClient();
    client.getTransceiver().send(ProtocolCreate.createMove((int) mPoint.x, (int) mPoint.y, mPoint.id));

  }

  protected boolean checkUserRoot() {
    int mode = TouchCore.get().getMode();
    SocketClient client = TouchCore.get().getClient();
    if (mode == TouchCore.AUTO && client != null || mode == TouchCore.ROOT && client != null) {
      return true;
    }
    return false;
  }
}
